/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package eproject_sem2;

import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author ZER0
 */
public class Login_Sever {

    String user = ConnectSQL.user;
    String pass = ConnectSQL.pass;
    String ulr =ConnectSQL.ulr;
    String DriverClass =ConnectSQL.DriverClass;
    Connection con = null;
    public String CheckUSer(String u, String password) {
        String kq = null;
        try {

            Class.forName(DriverClass);
            con = DriverManager.getConnection(ulr, user, pass);
            String sql3 = "select * from Users where Username='" + u + "' and Password='" + password + "'";
            Statement st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
            ResultSet rs = st.executeQuery(sql3);
            while (rs.next()) {
                kq = rs.getString(3);
            }
        } catch (SQLException ex) {
            Logger.getLogger(Login_Sever.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(Login_Sever.class.getName()).log(Level.SEVERE, null, ex);
        }
        return kq;
    }

    public String CheckName(String IDE,int c) {
        String rsE = null;
        try {

            Class.forName(DriverClass);
            con = DriverManager.getConnection(ulr, user, pass);
            String sql3 = "select * from Employee where EmployeeID='" + IDE + "'";
            Statement st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
            ResultSet rs = st.executeQuery(sql3);
            while (rs.next()) {
                rsE = rs.getString(c);
                break;
            }
        } catch (SQLException ex) {
            Logger.getLogger(Login_Sever.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(Login_Sever.class.getName()).log(Level.SEVERE, null, ex);
        }
        return rsE;
    }
}
